package com.example.dto;

import com.example.domain.Orders;
import com.example.domain.other.Address;
import com.example.domain.other.OrderDetail;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

@Data
public class OrderAddressDetailDto {
    private Long id;          //订单号
    private Integer status;   //订单状态 1待付款，2待派送，3已派送，4已完成，5已取消
    private Long userId;  //下单用户id
    private Long addressId;  //地址id
    private LocalDateTime orderTime;  //下单时间
    private LocalDateTime checkoutTime;  //结账时间
    private Integer payMethod;   //支付方式 1微信，2支付宝
    private BigDecimal amount;  //实收金额

    private String name;    //收货人
    private String phone;
    private String detail;

    private List<OrderDetail> list=new ArrayList<>();

    public void getByOAD(Orders order, Address address, List<OrderDetail> list){
        this.id=order.getId();this.status=order.getStatus();this.userId=order.getUserId();
        this.addressId=order.getAddressId();this.orderTime=order.getOrderTime();
        this.checkoutTime=order.getCheckoutTime();this.payMethod=order.getPayMethod();
        this.amount=order.getAmount();
        this.name=address.getName();
        this.phone=address.getPhone();
        this.detail=address.getDetail();
        this.list=list;
    }
}
